import { View } from "../../../../mvc/core/View";
import { LayerManager } from "../../../manager/LayerManager";
import { ObjCreate } from "../../common/ObjCreate";
import { ResFileConst } from "../../../resource/ResFileConst";
import { SecTimerView } from "../../common/SecTimerView";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { FilterConst } from "../../../../component/gconst/FilterConst";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { HighlightManager } from "../../../manager/HighlightManager";
import { ObjectPool } from "../../../../../com/gengine/utils/pools/ObjectPool";
import { SGuildPartyOpen } from "../../../../../Message/Game/SGuildPartyOpen";
import { GLoadedButton } from "../../../../../com/mui/controls/GLoadedButton";
type int = number;
//class GuildPartyIconView
    
    export  class GuildPartyIconView extends View
    {
        constructor()
        {
            super();
            this.layer = LayerManager.rightTopUILayer;
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this._iconBtn = ObjCreate.createGLoadedButton(ResFileConst.GuildPartyIcon, 0, 0, 50, 50, this);
            this._iconBtn.configEventListener(flash.events.MouseEvent.CLICK, this.onIconBtnClick);
            this._leftTime = new SecTimerView();
            this._leftTime.mouseEnabled = false;
            var loc1=new GTextFormat(FontUtil.songtiName, 12, 16580352);
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this._leftTime.defaultTextFormat = loc1;
            this._leftTime.filters = [FilterConst.glowFilter];
            ObjCreate.setObjAttri(this._leftTime, -3, 55, 60, 20, this);
            return;
        }

        /* internal  */onIconBtnClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildPartyJoinWindowOpen, this.partyOpen));
            return;
        }

        public updateLeftTime(arg1: int): void
        {
            this._leftTime.setLeftTime(arg1);
            return;
        }

        /* internal  */flicker(): void
        {
            HighlightManager.instance.glowEffectButton(this._iconBtn, true);
            return;
        }

        /* internal  */showLightMask(): void
        {
            if (!this._lightMask) 
            {
                this._lightMask = ObjectPool.getObject(LightMask);
                this._lightMask.transform.matrix = new Object /* flash.geom.Matrix */();
                this._lightMask.x = 2;
                this._lightMask.y = 2;
                this._lightMask.scaleX = 55 / 42.5;
                this._lightMask.scaleY = 55 / 42.5;
                this._iconBtn.addChild(this._lightMask);
            }
            return;
        }

        public /* override */ show(arg1: int=0, arg2: int=0): void
        {
            super.show(arg1, arg2);
            this.showLightMask();
            return;
        }

        /* internal */ /* var */_lightMask: LightMask;

        public /* var */partyOpen: SGuildPartyOpen;

        /* internal */ /* var */_iconBtn: GLoadedButton;

        /* internal */ /* var */_leftTime: SecTimerView;
    }
